package com.example.juc;

import java.util.concurrent.TimeUnit;

/**
 * @see java.time.Duration
 */
public class TimeUnitTest {
    public static void main(String[] args) {
        long day = 1;
        long second = TimeUnit.SECONDS.convert(day, TimeUnit.HOURS);
        System.out.println("一天有多少秒: " + second);
        long hour = 1;
        long minutes = TimeUnit.MINUTES.convert(hour, TimeUnit.HOURS);
        System.out.println("一小时多少分钟: " + minutes);

        try {
            System.out.println("休眠开始");
            TimeUnit.SECONDS.sleep(10);
            System.out.println("休眠结束");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
